/**
 * @param {number[]} height
 * @return {number}
 */
export var maxArea = function (height) {
  let ans = 0
  let [l, r] = [0, height.length - 1]
  while (l < r) {
    const h = Math.min(height[l], height[r])
    const s = h * (r - l)
    ans = Math.max(ans, s)
    if (height[l] < height[r]) l++
    else r--
  }
  return ans
}
